﻿using Castle.DynamicProxy;
using Microsoft.Extensions.Logging;
using Repository;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace IdentityServer4Blazor.Server.CustomInterceptor
{
    public class ServiceInterceptor : IInterceptor
    {
        public void Intercept(IInvocation invocation)
        {
            Log.Logger.Debug($"方法调用:{invocation.TargetType.Name}-{invocation.Method.Name}");
            var obj = invocation.InvocationTarget as dynamic;
            obj.SaveChanges();
            invocation.Proceed();
        }
    }
}
